# Contributor: Michał Polański <michal@polanski.me>
# Maintainer: Michał Polański <michal@polanski.me>
pkgname=netavark
pkgver=1.13.0
pkgrel=0
pkgdesc="Container network stack"
url="https://github.com/containers/netavark"
license="Apache-2.0"
# s390x: fails to build due to nix crate
arch="all !s390x"
makedepends="cargo go-md2man protoc"
subpackages="$pkgname-doc"
source="https://github.com/containers/netavark/archive/v$pkgver/netavark-$pkgver.tar.gz"
options="net"

prepare() {
	default_prepare

	cargo fetch --target="$CTARGET" --locked
}

build() {
	cargo build --release --frozen --bin netavark

	go-md2man -in docs/netavark.1.md -out docs/netavark.1
}

check() {
	cargo test --frozen
}

package() {
	install -Dm755 target/release/netavark \
		-t "$pkgdir"/usr/libexec/podman/
	install -Dm644 docs/netavark.1 \
		-t "$pkgdir"/usr/share/man/man1/
}

sha512sums="
7e0937fc52f70df1376f14a7cf6be42a0c2733a471db9c474ae6dd61c4563d6de93d3461876ed23d5d6802a01ade079d2543a54b1a0bf8d4f56d7ede52a1d043  netavark-1.13.0.tar.gz
"
